/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package wwcontrolserver.controls;

import java.io.Serializable;

/**
 *
 * @author Michael Ferry
 */
public class SetPointHeaterControlState extends AbstractControlState implements Serializable {
    //variables whic can be set by an external source
    public static final boolean DefaultCentralTimerNotficationState = true;
    protected double SetPointTemp;
    protected double SetPointRange;
    protected double WarningPointTemp;
    protected boolean ControlActivation;
    private static final double WARNING_TEMP_MULTIPLIER = 1.25;
    public static final double DEFAULT_DIGESTER_TEMP_SET_POINT = 34.5;
    public static final double DEFAULT_DIGESTER_TEMP_SET_RANGE = 0.5;
    //protected boolean ControlState;
    public static final boolean DEFAULT_CONTROL_STATE = true;
    private static final long serialVersionUID = -6011414256043897819L;
    
    
    public SetPointHeaterControlState(int ControlID, String ControlName, double SetPointTemp, double SetPointRange, boolean ControlActivation){
        super(ControlID, ControlName, DefaultCentralTimerNotficationState);
        this.SetPointTemp = SetPointTemp;
        this.WarningPointTemp = SetPointTemp * WARNING_TEMP_MULTIPLIER;
        this.SetPointRange = SetPointRange;
        this.ControlActivation = ControlActivation;
    }
    public double GetSetPointTemp(){
        return SetPointTemp;
    }
    public double GetWarningPointTemp(){
        return WarningPointTemp;
    }
    public double GetSetPointRange(){
        return SetPointRange;
    }
    public boolean GetControlActivation(){
        return ControlActivation;
    }
    @Override
    protected void UpdateControlState(AbstractControlState AbstractState) throws Exception{
        if (AbstractState instanceof SetPointHeaterControlState) {
             
            SetPointHeaterControlState DesiredState = (SetPointHeaterControlState) AbstractState;
            this.ControlActivation = DesiredState.ControlActivation;
            this.SetPointRange = DesiredState.SetPointRange;
            this.SetPointTemp = DesiredState.SetPointTemp;
            this.WarningPointTemp = SetPointTemp * WARNING_TEMP_MULTIPLIER;

        }else{
            throw new Exception();
        }
    }
    @Override
    protected void SetOffState(){
        this.ControlActivation = false;
    }
    
}
